<?php

function smarty_function_formatdate($params, &$smarty)
{

    if ($params['zone']=="") {
        $smarty->trigger_error("formatdate: missing 'zone' parameter");
        return;
    } elseif (empty($params['date'])) {
        $smarty->trigger_error("formatdate: missing 'date' parameter");
        return;
    } else {
    	if (empty($params['format'])) {
    		$format = "Y-m-d H:i";
    	} else {
    		$format = $params['format'];
    	}
    	$zone = $params['zone'];
    	$date = $params['date'];
    }

	$ntime = strtotime($date) + (($zone/100)*60*60);
	return date($format,$ntime);
		
}

?>
